<!-- FSharpSyntaxMode.xml

 Author:
   Mike Krüger <mkrueger@novell.com>

 Copyright (c) 2007 Novell, Inc (http://www.novell.com)

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:

 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE. -->

<SyntaxMode name="F#" mimeTypes="text/x-fsharp">
	<Property name="LineComment">//</Property>
	<Property name="BlockCommentStart">(*</Property>
	<Property name="BlockCommentEnd">*)</Property>
	<Property name="StringQuote">"</Property>

	<Delimiters>&amp;&lt;&gt;~@%^*()-+=|\#/{}[]:;"' ,	?</Delimiters>

	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#if</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#else</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#elif</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#endif</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#load</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#r</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#reference</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#nowarn</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#time</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#q</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#quit</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#help</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#include</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#I</EolSpan>
	<EolSpan tagColor = "Preprocessor" rule="text.preprocessor">#light</EolSpan>

	<EolSpan color="Comment(Doc)" rule="XmlDocumentation" tagColor="Comment(DocTag)">///</EolSpan>
	<EolSpan color="Comment(Line)" rule="Comment" tagColor="Comment(Line)">//</EolSpan>

	<Span color="Comment(Block)" rule="MultiComment" tagColor="Comment(Line)">
		<Begin>(*®)</Begin>
		<End>*)</End>
	</Span>
	
	<Span color="String(C# @ Verbatim)" rule="VerbatimString" stopateol="false" escape='""'>
		<Begin>@"</Begin>
		<End>"</End>
	</Span>
	
	<Span color="String(C# @ Verbatim)" rule="TripleQuotedString" stopateol="false">
		<Begin>"""</Begin>
		<End>"""</End>
	</Span>
	
	<Span color = "String" rule="String" stopateol = "true" escape='\"'>
		<Begin>"</Begin>
		<End>"</End>
	</Span>

	<Span color = "String" rule="String" stopateol = "true" escape="\'">
		<Begin>&apos;</Begin>
		<End>&apos;</End>
	</Span>
	
	<Span rule="Let" stopateol = "false">
		<Begin color="Keyword(Iteration)" flags="NewWord">let </Begin>
		<End>=|(|&lt;</End>
	</Span>

<!-- 
	<Span color="String" rule="String" stopateol="true" escape='\'>
		<Begin>[]</Begin>
		<End>"</End>
	</Span>
	-->

	<!-- ' is also used for type parameters therefore we need a regex match to find out if something is a char literal 
         Here we capture unicode literals and escaped chars in a separate group for colouring. Char literals are not part
         of the 'String' rule, and unicode literal matching will not happen. -->
<!--	<Match expression="(')(?:(apa|\\U[0-9a-fA-F]{8}|\\u[0-9a-fA-F]{4}|\\[\\'ntbrafv])|([^\\']))(')">
       <Group color="String"/>
       <Group color="String(Escape)"/>
       <Group color="String"/>
       <Group color="String"/>
	</Match> -->

	<Match color="String" ignorecase="True">'(\w|\\['ntbrafv])'</Match>
       


	<Match color="Number">CSharpNumber</Match>
	<Match color="Keyword(Iteration)">(let|use|yield|return|do)(!)?\s</Match>
	<Match color="Keyword(Iteration)">(let|use|yield|return|do)(!)?$</Match>

	<!-- reserved-ident-keyword F# spec v3.0 section 3.4 -->
	<Match color="Keyword(Other)">(atomic|break|checked|component|const|constraint|constructor|continue|eager|fixed|fori|functor|include|measure|method|mixin|object|parallel|params|process|protected|pure|recursive|sealed|tailcall|trait|virtual|volatile)[!#]?\s</Match>
	<Match color="Keyword(Other)">(atomic|break|checked|component|const|constraint|constructor|continue|eager|fixed|fori|functor|include|measure|method|mixin|object|parallel|params|process|protected|pure|recursive|sealed|tailcall|trait|virtual|volatile)[!#]?$</Match>

	<!-- It is really impossible to do some intelligent grouping here, because
	     it looks weird no matter what we do... some things are context-sensitive,
	     some things may appear in unexpected place.. so just use single color -->

	<Keywords color="Keyword(Jump)">
		<!-- expressions that create some value -->
		<Word>fun</Word>
		<Word>function</Word>
		<Word>new</Word>
	</Keywords>

	<Keywords color="Keyword(Iteration)">
		<!-- control flow constructs -->
		<Word>finally</Word>
		<Word>try</Word>
		<Word>with</Word>

		<Word>val</Word>
		<Word>while</Word>
		<Word>for</Word>

		<Word>begin</Word>
		<Word>done</Word>
		<Word>elif</Word>
		<Word>else</Word>
		<Word>end</Word>
		<Word>if</Word>
		<Word>match</Word>
		<Word>then</Word>
		<Word>when</Word>

		<!-- object model things -->
		<Word>inline</Word>
		<Word>static</Word>
		<Word>abstract</Word>
		<Word>override</Word>
		<Word>private</Word>
		<Word>public</Word>
		<Word>extern</Word>
		<Word>internal</Word>
		<Word>mutable</Word>
		<Word>rec</Word>
		<Word>void</Word>

		<Word>global</Word>
		<Word>base</Word>
		<Word>default</Word>
		<Word>inherit</Word>
		<Word>member</Word>
		<Word>type</Word>

		<Word>of</Word>
		<Word>class</Word>
		<Word>delegate</Word>
		<Word>exception</Word>
		<Word>interface</Word>
		<Word>struct</Word>
	</Keywords>

	<Keywords color="Keyword(Operator)">
		<Word>as</Word>
		<Word>assert</Word>
		<Word>or</Word>
		<Word>downto</Word>
		<Word>in</Word>
		<Word>to</Word>
		<Word>upcast</Word>
		<Word>lazy</Word>
		<Word>and</Word>
		<Word>downcast</Word>
		<Word>select</Word>
	</Keywords>

	<Keywords color="Keyword(Constants)">
		<Word>false</Word>
		<Word>null</Word>
		<Word>true</Word>
		
		<Word>__LINE__</Word>
		<Word>__SOURCE_DIRECTORY__</Word>
		<Word>__SOURCE_FILE__</Word>
	</Keywords>

	<Keywords color="Keyword(Type)">
	</Keywords>

	<Keywords color="Keyword(Void)">
	</Keywords>

	<Keywords color="Keyword(Namespace)">
		<Word>module</Word>
		<Word>namespace</Word>
		<Word>open</Word>
	</Keywords>

	<Keywords color="Keyword(Property)">
	</Keywords>

	<Keywords color="Keyword(Declaration)">
	</Keywords>

	<Keywords color="Keyword(Parameter)">
	</Keywords>


	<Keywords color="Keyword(Operator Declaration)">
	</Keywords>

	<Keywords color="Keyword(Other)">
		<!-- reserved OCaml keywords -->
		<Word>asr</Word>
		<Word>land</Word>
		<Word>lor</Word>
		<Word>lsl</Word>
		<Word>lsr</Word>
		<Word>lxor</Word>
		<Word>mod</Word>
		<Word>sig</Word>
	</Keywords>

	<Rule name="text.preprocessor" ignorecase="True">
		<Span color = "String" rule="String" stopateol = "true">
			<Begin>"</Begin>
			<End>"</End>
		</Span>
		
		<Keywords color = "Keyword(Constants)">
			<Word>true</Word>
			<Word>false</Word>
		</Keywords>
		
		<Keywords color = "Punctuation">
			<Word>==</Word>
			<Word>!=</Word>
			<Word>!</Word>
			<Word>&amp;&amp;</Word>
			<Word>||</Word>
		</Keywords>
	
		<Keywords color = "Punctuation(Brackets)">
			<Word>(</Word>
			<Word>)</Word>
		</Keywords>


		<EolSpan color = "Comment(Doc)" rule="XmlDocumentation" tagColor="Comment(DocTag)">///</EolSpan>
		<EolSpan color = "Comment(Line)" rule="Comment" tagColor="Comment(Line)">//</EolSpan>
	</Rule>
	
	<Rule name="Comment">
		<Keywords color="Comment Tag" ignorecase="True">
			<Word>TODO</Word>
			<Word>FIXME</Word>
			<Word>HACK</Word>
			<Word>UNDONE</Word>
		</Keywords>
	</Rule>
  
	<Rule name="MultiComment">
	
		<!-- let a = (* let s = "*)" *) -->
		<Span rule="String" stopateol="true">
			<Begin>"</Begin>
			<End>"</End>
		</Span>

		<Span color="Comment(Block)" rule="MultiComment">
			<Begin>(*®)</Begin>
			<End>*)</End>
		</Span>

		<Keywords color="Comment Tag" ignorecase="True">
			<Word>TODO</Word>
			<Word>FIXME</Word>
			<Word>HACK</Word>
			<Word>UNDONE</Word>
		</Keywords>
	</Rule>

	<Rule name="String">
		<Match color ="String(Escape)" ignorecase="True">\\(U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|[\\'ntbrafv])</Match>
	</Rule>
	
	<Rule name="Let">
	</Rule>
	
	<Rule name = "VerbatimString">
		<Delimiters></Delimiters>
		<Match color ="String(Escape)">""</Match>
	</Rule>

	<Rule name = "TripleQuotedString">
		<Delimiters></Delimiters>
	</Rule>

	<Rule name="XmlDocumentation">
		<Delimiters>&lt;&gt;</Delimiters>
		<Span color = "Comment(DocTag)" rule = "XmlDocumentationTag" stopateol = "true">
			<Begin>&lt;</Begin>
			<End>&gt;</End>
		</Span>
	</Rule>

</SyntaxMode>